import 'dart:convert';

import 'package:dio/dio.dart';

import '../DL_Config.dart';

class DlDiorequest {
  final dio = Dio();

  requestAllData() async {
    String url = DL_Config.DL_address;
    String URLStr = '$url/index.php/Api/dearLotteryRawData';
    var data;
    try {
      final response = await dio.post(URLStr);

      /// 格式化接收到的数据
      data = jsonDecode(response.data);
    } catch (e) {
      data = {"status": 100, "code": 0, "message": "", "data": []};
    }

    return data;
  }

  requestNextDrawData() async {
    String url = DL_Config.DL_address;
    String URLStr = '$url/index.php/Api/dearLotteryNextDraw';
    var data;
    try {
      final response = await dio.post(URLStr);

      /// 格式化接收到的数据
      data = jsonDecode(response.data);
    } catch (e) {
      data = {"status": 100, "code": 0, "message": "", "data": []};
    }

    return data;
  }
}
